import java.util.ArrayList;
import java.util.HashMap;

public class Main{
    public static void main(String[] args) {
       /*
        //arraylist 增删查改

        //定义arrayList对象
        ArrayList<String> arrayList =new ArrayList<>();
        System.out.println("集合的长度："+arrayList.size());
        //增加操作
        arrayList.add("123");
        arrayList.add("456");
        arrayList.add("789");
        arrayList.add("123");
        arrayList.add("456");
        arrayList.add("789");
        System.out.println("集合的长度："+arrayList.size());
        //arrayList删除
        //arrayList.remove("123");
        //arrayList.remove("123");
        arrayList.remove(3);
        //arrayList的查找
        System.out.println("第5个元素的值："+arrayList.get(4));
        //遍历arrayList
        for (int i = 0; i< arrayList.size(); i++){
            System.out.println(arrayList.get(i));
       }
     */
       //HashMap的定义
        HashMap<String,String> hashMap =new HashMap<>();
        //增加操作
        hashMap.put("key1","value1");
        hashMap.put("key2","value2");
        hashMap.put("key3","value3");
        hashMap.put("key4","value4");
        //删除操作
        hashMap.remove("key3");
        //修改操作
        hashMap.put("key4","这是被修改过后的key4");
        //遍历操作
        System.out.println(hashMap.get("key4"));
        for (String key : hashMap.keySet()){
            System.out.println("key是："+key +"| Value是："+ hashMap.get(key) );
        }
    }
}